package com.ms.p2p.service.impl;

import com.ms.p2p.dao.DictionaryDao;
import com.ms.p2p.entity.system.Dictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DictionaryServiceImpl{
    @Autowired
    DictionaryDao dictionaryDao;

    @Cacheable(value="dictionary",key="'id'+#id")
    public Dictionary get(int id) {
        return dictionaryDao.get(id+"");
    }

    @Cacheable(value="dictionary",key="'type'+#type")
    public List<Dictionary> getdictListByTypeId(String type) {
        List<Dictionary> list =dictionaryDao.getDictListByType(type);
        return  list;
    }
    @Cacheable(value="dictionary",key="'type'+#type+'dict_value'+#dict_value")
    public String getDictValue(String type, String dict_value){
        return dictionaryDao.getDictValue(type, dict_value);

    }


}
